Refactor: Standardize country names in filters and sightings #178
+81
−42
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Show country names consistently in filters and sightings
Closes #159
What changed
The country filter showed names ("Norway"), but sighting results showed codes ("NO"). Now every place that shows a country uses one shared formatter:
formatCountryinfrontend/src/utils/format-sighting.ts. It uses the existingcountryNameFromCodeinutils/countries.ts, which the submit form already uses.formatLocationnow ends with the country name, for example "Oslo, OS, Norway" instead of "Oslo, OS, NO". This changes the results list, map labels, the detail page heading and the page title.SearchFiltersno longer has its ownIntl.DisplayNameshelper. The dropdown and the active-filter chips useformatCountry.Missing and unknown countries
no)xx)nullor blank)Not included: countries filled in from coordinates by the backfill (#123) can't be marked as uncertain. The API has no field that says which ones were inferred, and adding one would change the database and GraphQL schema. That should be its own issue if we want it.
Tests
formatCountrywith known, unknown and missing codes, plus updatedformatLocationtests.npm run lint,npm run format:check,npm run testandnpm run test:e2eall pass.How to check
npm run devandnpm run dev:backend